<template>
  <chart v-bind="$attrs" :option="option"></chart>
</template>

<script>
export default {
  name: "ChinaMap",
  data() {
    return {
      option: {
        tooltip: {}, // 鼠标移到图里面的浮动提示框
        geo: {
          map: "china",
          roam: false,
          label: {
            normal: {
              show: true, // 是否显示对应地名
              textStyle: {
                color: "rgba(0,0,0,0.4)"
              }
            }
          },
          itemStyle: {
            normal: {
              borderColor: "rgba(0, 0, 0, 0.2)"
            },
            emphasis: {
              areaColor: null,
              shadowOffsetX: 0,
              shadowOffsetY: 0,
              shadowBlur: 20,
              borderWidth: 0,
              shadowColor: "rgba(0, 0, 0, 0.5)"
            }
          }
        },
        visualMap: {
          show: true,
          x: "left",
          y: "bottom",
          splitList: [
            { start: 1, end: 100 },
            { start: 100, end: 200 },
            { start: 200, end: 300 },
            { start: 300, end: 400 },
            { start: 400, end: 500 },
            { start: 500, end: 600 },
            { start: 600, end: 700 },
            { start: 700, end: 800 },
            { start: 800 }
          ],
          color: [
            "#edb08c",
            "#fed189",
            "#d3e493",
            "#edf099",
            "#e6e6e8",
            "#fcd1e3",
            "#b3d6db",
            "#afd8fc"
          ]
        },
        series: [
          {
            type: "scatter",
            coordinateSystem: "geo" // 对应上方配置
          },
          {
            name: "景点数量", // 浮动框的标题
            type: "map",
            geoIndex: 0,
            data: [
              {
                name: "广东",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "江苏",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "河南",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "新疆",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "浙江",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "西藏",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "青海",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "甘肃",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "宁夏",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "内蒙古",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "黑龙江",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "吉林",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "辽宁",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "北京",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "天津",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "河北",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "山西",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "陕西",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "四川",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "云南",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "安徽",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "湖北",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "重庆",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "贵州",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "湖南",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "江西",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "福建",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "广西",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "海南",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "台湾",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "山东",
                value: parseInt((Math.random() * 1000).toFixed(0))
              },
              {
                name: "上海",
                value: parseInt((Math.random() * 1000).toFixed(0))
              }
            ]
          }
        ]
      }
    };
  }
};
</script>

<style scoped></style>
